/**
 * 
 */

	$(document).ready(function(){
		
		$("input[type='checkbox']").click(function(){
			
		if(this.checked==true){
			$(".hid_tips").css("display","block");
		}
		else{
			$(".hid_tips").css("display","none");
		}
			
	})
		
	})
	
	function a(){
		$("#yzm_img").attr("src","../Code?i"+Math.random());
	}
	
	function login(){
		var yzm=$(".ipt_yzm").val();
		$.get("../UserServlet?m=jiaoyan",{yzm:yzm},function(f){
			 //alert(e);
			if(f=="111"){
				var uname=$("#username").val();
				 var upass=$("#password").val();
				 //alert(uname+upass);
				 $.get("../UserServlet?m=login",{username:uname,password:upass},function(e){
				//alert(e);
				  if(e=="ok"){
					  alert("登录成功");
					 window.location.href="mainpage.jsp"; 
				  }else if(e=="fail"){
					 alert("账号或密码错误");
					 $("#password").val("");
					 $(".ipt_yzm").val("");
					 $("#yzm_img").attr("src","../Code?i"+Math.random());
				  }
				 })	 
			}
			else {
				alert("验证码错误");
				$(".ipt_yzm").val("");
				$("#yzm_img").attr("src","../Code?i"+Math.random());
			}
		})
	}
	
	
	